/*
 * @lc app=leetcode.cn id=762 lang=typescript
 *
 * [762] 二进制表示中质数个计算置位
 */

// @lc code=start
function countPrimeSetBits(left: number, right: number): number {
    let final = 0;
    for (let index = left; index <= right; index++) {
        const count = index.toString(2).split("0").join("").length;

        isPrime(count) && final++;
    }
    return final;
}
const isPrime = (count: number) => {
    if (count < 2) return false;
    for (let index = 2; index < count; index++) {
        if (count % index === 0) return false;
    }
    return true;
};
// @lc code=end
